import java.util.Scanner;
public class J1509 {
    //移动n层函数
    public static void move(int n, char begin, char tmp, char end){
        if(n == 1){
            System.out.println(begin + ">>" + end);
        }else{
            move(n - 1, begin, end, tmp);//将(n - 1)层从起始位置移动到中转位置
            System.out.println(begin + ">>" + end);
            move(n - 1, tmp, begin, end);//将(n - 1)层从中转位置移动到终点位置
        }
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        move(n,'a','b','c');
        System.out.print("\n" + "移动" + n + "层需要" + ((int)(Math.pow(2,n) - 1)) + "步");
    }
}
